package gov.kqqzyyy.monkey.tjpd.mytools;

import android.content.Context;

import com.socks.library.KLog;

/**
 * Created by Monkey on 2016/2/2.
 * Edit by Monkey
 */
public class CurrentVersion {

    //获取当前版本代码
    public static int getVerCode(Context context) {
        int verCode = -1;
        try {
            verCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
        } catch (Exception e) {
            KLog.d("APE", e.getMessage());
            e.printStackTrace();
        }
        return verCode;
    }

    //获取当前版本名称
    public static String getVerName(Context context) {
        String verName = "";
        try {
            verName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (Exception e) {
            KLog.d("APE", e.getMessage());
            e.printStackTrace();
        }
        return verName;
    }
}
